package com.eastfair.saga.proxy;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * ProductService
 *
 * @author dmego
 * @date 2021/3/31 10:48
 */
//@FeignClient(value = "saga-product-service")
//@RequestMapping("/product")
public interface ProductService {

    /**
     * 开始扣减库存
     * @param productId
     * @param count
     * @return
     * @throws Exception
     */
//    @RequestMapping("/reduceStock")
    Boolean reduceStock(@RequestParam("productId") Long productId, @RequestParam("count") Integer count) throws Exception;

    /**
     * 开始回滚库存
     * @param productId
     * @param count
     * @return
     * @throws Exception
     */
//    @RequestMapping("/compensateStock")
    Boolean compensateStock(@RequestParam("productId") Long productId, @RequestParam("count") Integer count) throws Exception;

    /**
     * 查询商品价格
     * @param productId
     * @return
     */
//    @GetMapping("/getPrice")
    Integer getPrice(@RequestParam("productId") Long productId);

}
